package edu.spec.sms.model.questionnaire;

import edu.spec.sms.model.Student;

import javax.persistence.*;

/**
 * "学生"和问卷调查的"题目"关联表
 *
 */
@Entity
@Table(name = "t_student_subject")
public class StudentSubject {
    private Integer id;
    private Student student;
//    private Questionnaire questionnaire;
    private Subject subject;
    private Integer answer;

    public StudentSubject() {
    }

    public StudentSubject(Student student, Subject subject, Integer answer) {
        this.student = student;
        this.subject = subject;
        this.answer = answer;
    }

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "student_id")
    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

//    @ManyToOne
//    @JoinColumn(name = "questionnaire_id")
//    public Questionnaire getQuestionnaire() {
//        return questionnaire;
//    }
//
//    public void setQuestionnaire(Questionnaire questionnaire) {
//        this.questionnaire = questionnaire;
//    }

    @ManyToOne
    @JoinColumn(name = "subject_id")
    public Subject getSubject() {
        return subject;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    public Integer getAnswer() {
        return answer;
    }

    public void setAnswer(Integer answer) {
        this.answer = answer;
    }
}
